/**   
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2021-01-15 16:10:34  
 * Copyright (c) 2015- -版权所有     
 */

package com.joysuch.wwyt.datasync.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_data_sync_info")
@Data
public class DataSyncInfo implements java.io.Serializable {

    // columns START
    @Id
    @GeneratedValue(strategy = IDENTITY)

    // ID
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    // 名表名
    @Column(name = "TABLE_NAME", length = 100, nullable = false)
    private String tableName;

    // 附件对应的主键值
    @Column(name = "PRIMARY_KEY")
    private String primaryKey;

    // 数据ID
    @Column(name = "DATA_ID", nullable = false)
    private Long dataId;

    // 变更类型: A: 新增，U：更新，D：删除
    @Column(name = "CHANGE_TYPE", length = 500, nullable = false)
    private String changeType;

    // 数据内容
    @Column(name = "CONTENT", length = 65535)
    private String content;

    // 响应时间
    @Column(name = "RESPONSE_TIME", nullable = false)
    private java.util.Date responseTime;

    // 响应内容
    @Column(name = "RESPONSE_CONTENT", length = 65535, nullable = false)
    private String responseContent;

    // 组织编码
    @Column(name = "ORG_CODE", length = 64, nullable = false)
    private String orgCode;

    // 状态
    @Column(name = "STATE")
    private Byte state;

    // 租户
    @Column(name = "TENENT_ID")
    private Long tenentId;

    // 创建时间
    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    private java.util.Date createTime;

    // 更新时间
    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    private java.util.Date updateTime;
    // columns END

    public int hashCode() {
        return new HashCodeBuilder()
                .append(getId())
                .toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof DataSyncInfo == false)
            return false;
        if (this == obj)
            return true;
        DataSyncInfo other = (DataSyncInfo) obj;
        return new EqualsBuilder()
                .append(getId(), other.getId())
                .isEquals();
    }
}
